<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/23
 * Time: 15:16
 */
namespace app\home\controller;

use app\home\controller\Base;
use think\Request;
use think\Session;

class Index extends Base {
    public function _initialize()
    {
        parent::_initialize();
    }
    /**
     * 首页展示
     */
    public function index()
    {
        // 账户信息
        $user_info = model('Personal')->getUserInfoM();
        $user_info['auth'] = "/public/static/phone/images/nauth.png";   // 未资质认证
        if($user_info['aid']){
            $user_info['auth'] = "/public/static/phone/images/yauth.png";   // 资质认证
        }
        $this->assign('user_info',$user_info);
        // 账户余额
        $balance = model('Personal')->getMyAccountBalanceM();
        $this->assign('balance',$balance);
        // 总卡量、本月到期卡量
        $card_quantity = model('Index')->getCardQuantityM();
        $this->assign('card_quantity',$card_quantity);
        // 公告信息
        $notice = model('Index')->getNoticeM();
        $this->assign('notice',$notice);
        return view();
    }
    
    /**
     * 上传图片
     */
    public function uploadImage()
    {
        if(!$_FILES){
            return ['code'=>1,'msg'=>'请上传图片'];
        }
        $name = Request::instance()->post('name');
        $result = F_upload_picture($name, $size = 1);
        return $result;
    }

    /**
     * 问题反馈页面
     */
    public function feedback()
    {
        return view();
    }
    
    /**
     * 提交反馈信息
     */
    public function submitFeed()
    {
        $result = model('Index')->submitFeedM();
        return $result;
    }

    /**
     * 公告详情
     */
    public function noticeDetails()
    {
        $details = model('Index')->getNoticeM();
        $this->assign('details',$details['0']);
        return view();
    }

}